/**
 * 宝箱
 */

 export default class Chest extends Laya.Script {

    constructor() { super() }

    private sprite: Laya.Sprite

    onEnable(): void {
        this.sprite = this.owner as Laya.Sprite
    }

    onDisable(): void {
        Laya.Pool.recoverByClass(Chest)
    }

    public open(): void {
        this.sprite.loadImage('images/chest_open.png')
        Laya.Tween.to(this.sprite, {scaleX: 1.5, scaleY: 1.5}, 500, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
            this.sprite.removeSelf()
        }))
    }

 }